package com.ymatou.iapi.coupon.testcase;

import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;



import org.apache.http.client.ClientProtocolException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.coupon.parameter.ActivityPriceDto;
import com.ymatou.iapi.coupon.parameter.BestCouponInfo;
import com.ymatou.iapi.coupon.parameter.GetProductBestCouponBean;
import com.ymatou.iapi.coupon.parameter.RuleDto;
import com.ymatou.iapi.coupon.parameter.availableCoupon;
import com.ymatou.iapi.coupon.parameter.bestCoupon;
import com.ymatou.iapi.coupon.service.GetProductBestCouponCall;
import com.ymatou.iapi.couponmanage.parameter.CreateCouponBean;
import com.ymatou.iapi.couponmanage.parameter.SellerCreateBatchBean;
import com.ymatou.iapi.couponmanage.service.CreateCouponCall;
import com.ymatou.iapi.couponmanage.service.SellerCreateBatchCall;
import com.ymatou.promotion.api.parameter.AvailableCouponInfo;
import com.ymt.base.YmatouEasyCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CouponServiceMCallServiceV2;
import com.ymttest.business.service.CouponServiceCallServiceV2;
import com.ymttest.database.model.coupon;
import com.ymttest.database.model.couponbatch;
import com.ymttest.database.sqlwapper.couponWapper;
import com.ymttest.database.sqlwapper.couponbatchWapper;
import com.ymttest.utils.TestDataManager;
/**
*商详最优的买手券和平台券
*FreeMaker Template自动生成代码
*/
@TestSuite
@Ignore
public class Ts_GetProductBestCoupon{
	private static GetProductBestCouponBean bean;
	private static GetProductBestCouponCall call;
	
	private  SellerCreateBatchBean sellerCreateBatchBean=new SellerCreateBatchBean();
	private  SellerCreateBatchCall sellerCreateBatchCall=new SellerCreateBatchCall();
	
	
	private  CreateCouponBean createCouponBean;
	private  CreateCouponCall createCouponCall;
	private  couponWapper couponWapper=new couponWapper();
	private couponbatchWapper couponbatchWapper=new couponbatchWapper();
	
	private CouponServiceMCallServiceV2 couponMService=new CouponServiceMCallServiceV2();
	private CouponServiceCallServiceV2 couponService=new CouponServiceCallServiceV2();
	//平台券没有指定任何条件
	private final String ruleId_All="e0d889ac817a4c6ea9188baa4d909d11";
	private final Integer operatorId=222222; //操作人
	private final String batchCode="NUVGKT1CKX";
	//平台券指定商品
	private final String ruleId_productId="a740cf9fe22a46dc91c89c09c72e61cf";
	private final String batchCode_productId="9PWHYKALTN";
	private final String productId="productId999";
	//平台券指定类目
	private final String batchCode_categories="YJMGNSAD12";
	private final Integer categoriesId=1001;
	private final String ruleId_categoriesId="150e3e4dd51d4b73852878b3219df31f";
	//平台券指定品牌
	private final String batchCode_brandId="UW4G6CL5K4";
	private final Integer brandId=500;
	private final String ruleId_brandId="66c69f29afba4b9bae8e1160c7828ba9";
	//平台券指定国家
	private final String batchCode_countryId="2Z6QLEQ5Q3";
	private final Integer countryId=10;
	private final String ruleId_countryId="a3e59ef735f64278a0c65093b6cf0503";
	//平台券指定活动
	private final String batchCode_activityId="4Z819QC1N9";
	private final Integer activityId=11;
	private final String ruleId_activityId="0fd76c0ee8f9485eab75a2ec31f9327c";
	//平台券指定psp
	private final String batchCode_isPsp="U5QFRZSAFF";
	private final boolean isPsp=true;
	private final String ruleId_isPsp="9873bbeb86ec4c18b5fdbe56af7023ce";
	//平台券指定使用团长券
	private final String batchCode_isGroup="CVHZTRMVEV";
	private final boolean isGroup=true;
	private final String ruleId_isGroup="ff31ec7e321a42a98c464ce397a24433";
	//平台券指定platformSource=0 c2c
	private final String batchCode_platformSource0="GHY5S1WPA2";
	private final Integer platformSource0=0;
	private final String ruleId_platformSource0="b234a0e9b93644a6abd4578fe639b100";
	//平台券指定platformSource=1 全球优选
	private final String batchCode_platformSource1="LN7HLL8JJA";
	private final Integer platformSource1=1;
	private final String ruleId_platformSource1="920e28b0e3444582891bbedff0972a93";
	//平台券设置每人可以领取2次
	private final String batchCode_receiveTimes2="V4XEHNTEWA";
	private final String ruleId_receiveTimes2="e3601aa38d71434b84cd1fa2ef97e1c1";
	
	//规则中有两张券
	private final String ruleId_two_4000000_3800000="cf398958b8d34f3a8d6a493cd4baea69";
	private final String ruleId_two_4000000_3900000="b8a41cf48808412bb6f9e28d0ee85380";
	private final String ruleId_two_4000000_3700000="e95a71ee1d5d42e78d3c0c4635cc8840";
	private final String batchCode_two_4000000_3800000="3V294LCJKZ";//满4000000减3800000
	private final String batchCode_two_4000000_3900000="ELMX48LFHZ";//满4000000减3900000
	private final String batchCode_two_4000000_3700000="TFXLSYWE58";//满4000000减3700000
	
	//新人优惠券
	private final String batchCode_newUser1="76ENJ46G8R";
	private final String batchCode_newUser2="WL374CVCMR";
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("商详最优的买手券和平台券(暂时不维护，汇总到总接口)");
		
	}

	@Before
	public void caseUp() {
		bean=new GetProductBestCouponBean();
		call=new GetProductBestCouponCall();
		createCouponBean=new CreateCouponBean();
		createCouponCall=new CreateCouponCall();
		couponbatchWapper.setNoInvalid(this.batchCode);
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	public void receiveCouponInfoByRule(Integer userId,String ruleId) throws ClientProtocolException, IOException
	{
		String deviceId="aaa"+TestDataManager.getRandomNum(5);
		String url="http://couponmarketingbiz.iapi.ymatou.com/api/couponmkting/ReceiveActivityCoupon";
		String str="{\"userId\":"+userId+",\"deviceId\":\""+deviceId+"\",\"activityname\":\""+ruleId+"\"}";
		YmatouEasyCall ec=new YmatouEasyCall(url, "POST", "JSON");
		ec.setData(str);
		ec.callService();
		String data=ec.getReturnData();
		System.out.print(data);
	}
	/**
	 * 设置默认的创建商家优惠券券,仅用于本接口 满3000000减3000
	 * 
	 * @return
	 * @throws IOException 
	 * @throws ClientProtocolException 
	 */
	public SellerCreateBatchBean DefaultSellerCreateBatchCall() throws ClientProtocolException, IOException {
		//SellerCreateBatchBean sellerCreateBatchBean = new SellerCreateBatchBean();

		int sellerid = TestDataManager.getRandomIntNum(6);
		sellerCreateBatchBean.setSellerId(sellerid);
		sellerCreateBatchBean.setBatchName("java化商家优惠券批次Name");
		sellerCreateBatchBean.setBatchDes("创建商家优惠券批次描述");

		Date dNow = new Date(); // 当前时间
		Date dBefore = new Date();
		Date dAfter = new Date();

		Calendar calendar1 = Calendar.getInstance(); // 得到日历
		calendar1.setTime(dNow);// 把当前时间赋给日历
		calendar1.add(Calendar.DAY_OF_MONTH, -1); // 
		dBefore = calendar1.getTime(); // 得到前一天的时间

		Calendar calendar2 = Calendar.getInstance(); // 得到日历
		calendar2.setTime(dNow);// 把当前时间赋给日历
		calendar2.add(Calendar.DAY_OF_MONTH, 1); // 
		dAfter = calendar2.getTime(); // 得到前一天的时间

		sellerCreateBatchBean.setEffectiveStartDate(dBefore);
		sellerCreateBatchBean.setEffectiveEndDate(dAfter);

		sellerCreateBatchBean.setOrderMinAmount(new BigDecimal(3000000));
		sellerCreateBatchBean.setCouponAmount(new BigDecimal(3000));

		sellerCreateBatchBean.setCouponTotalCount(1000);
		sellerCreateBatchBean.setReceiveNumPerUser(1);
		sellerCreateBatchBean.setIsShowOnPage(true);
		sellerCreateBatchBean.setCouponType((byte) 1);

		couponMService.deleteSellerBatchCountInCurrentMonthBysellerIdAnd30(sellerCreateBatchBean);
		//SellerCreateBatchCall sellerCreateBatchCall = new SellerCreateBatchCall();
		sellerCreateBatchCall.setData(sellerCreateBatchBean);
		sellerCreateBatchCall.callService();
		
		return sellerCreateBatchBean;
	}
	/**
	 * 验证都为空
	 */
	public void check_Empty()
	{
        Logger.verifyEquals("0", call.getStatusCode1(), "验证返回Code");
        Logger.verifyEquals("操作成功！",call.getMessage(), "验证返回Message");
        
        bestCoupon resp_best=call.getBestCouponList();
        BestCouponInfo return_best=resp_best.getBestCouponList().get(0);
        Logger.verifyEquals(bean.getActivityPriceList().get(0).getActivityId(), return_best.getActivityId(), "验证返回activityId与传入一致");
        Logger.verifyEquals(bean.getActivityPriceList().get(0).getPrice(), return_best.getPrice(), "验证返回price与传入一致");
        Logger.verifyEquals(null, return_best.getSellerCouponInfo(), "验证最优sellerCouponInfo为空");
        Logger.verifyEquals(null, return_best.getPlatformCouponInfo(), "验证最优platformCouponInfo为空");
        
        Logger.verifyEquals(0, call.getAvailableCouponList().getAvailableCouponList().size(), "验证最优availableCouponList为空");
	}
	/**
	 * 
	 * @param ruleId 规则Id
	 * @return
	 */
	private GetProductBestCouponBean initGetProductBestCoupon(Integer operatorId,String ruleId)
	{
		Integer buyerId=TestDataManager.getRandomIntNum(5);
		String productId="productId_"+TestDataManager.getRandomIntNum(5);
		bean.setBuyerId(buyerId);
		List<RuleDto> rules=new ArrayList();
		RuleDto ruleDto=new RuleDto();
		ruleDto.setRuleId(ruleId);//领券规则id（新人优惠券无规则ID）
		ruleDto.setMode(0);//0 = 平台优惠券 1=新人优惠券
		//2未下单会员,8已下单会员 32普通 64白银 128黄金 256铂金 512钻石 1024黑卡 2048非安利会员/大人 4096安利会员 8192安利达人 16黄牛
		ruleDto.setUserType(2);//用户身份
		rules.add(ruleDto);
		
		bean.setRules(rules);
		bean.setSellerId(operatorId);
		bean.setProductId(productId);
		
		List<Integer> categoryIds=new ArrayList();
		categoryIds.add(1001);
		categoryIds.add(1002);
		categoryIds.add(1003);
		bean.setCategoryIds(categoryIds);
		
		bean.setBrandId(200);
		//bean.setCountryId(10);
		
		List<ActivityPriceDto> activityPriceList=new ArrayList();
		ActivityPriceDto activityPriceDto=new ActivityPriceDto();
		activityPriceDto.setActivityId(11);//不允许更改
		activityPriceDto.setPrice(new BigDecimal(7000000));
		activityPriceDto.setDisplay(true);
		activityPriceList.add(activityPriceDto);
		bean.setActivityPriceList(activityPriceList);
		
		bean.setMemberGrade(0);
		bean.setPsp(false);
		bean.setPlatformSource(0);//平台来源（0-C2C，1-全球优选)
		bean.setUseCommander(false);
		bean.setPlatformId(0);
		bean.setCouponUseType(0);//在活动上使用限制 0 无限制  1不可用买手券 2不可用平台券 3不可用买手券以及平台券
		
		return bean;
	}
	
	
	/**
	 * 
	 * @param sellerbatchBean 买手券bean
	 * @param sellerbatchCall 买手券call
	 * @param createCouponBean 平台券bean
	 * @param createCouponCall 平台券call
	 * batchCode 用于平台
	 */
	private void check_verify( List<SellerCreateBatchBean> sellerbatchBean,List<SellerCreateBatchCall> sellerbatchCall,String... batchCode_other)
	{
		 String batchCode="";
		 Logger.verifyEquals("0", call.getStatusCode1(), "验证返回Code");
         Logger.verifyEquals("操作成功！",call.getMessage(), "验证返回Message");
         
         bestCoupon resp_best=call.getBestCouponList();
         availableCoupon resp_available=call.getAvailableCouponList();
         
         BestCouponInfo return_best=resp_best.getBestCouponList().get(0);
         List<AvailableCouponInfo> return_availableList=resp_available.getAvailableCouponList();
         
         Logger.verifyEquals(bean.getActivityPriceList().get(0).getActivityId(), return_best.getActivityId(), "验证返回activityId与传入一致");
         Logger.verifyEquals(bean.getActivityPriceList().get(0).getPrice(), return_best.getPrice(), "验证返回price与传入一致");
         //sellerCouponInfo
         Logger.comment("###########  验证bestCouponList ####################");
        
         if(resp_best.getBestCouponList().get(0).getPlatformCouponInfo()!=null)
         {
        	 batchCode=batchCode_other.length>0?batchCode_other[0]:this.batchCode;
         }
         if(resp_best.getBestCouponList().get(0).getSellerCouponInfo()!=null)
         {
        	 batchCode=sellerbatchCall.get(0).getBatchCode();
         }
         else
         {
        	// batchCode=batchCode_other[0];
         }
         
         couponbatch couponbatch=couponbatchWapper.selectBybatchCode(batchCode).get(0);
         List<coupon> coupons=couponWapper.selectByBatchIdAndUserId(couponbatch.getBatchId(),bean.getBuyerId());
         
         if(bean.getActivityPriceList().get(0).getPrice().compareTo(couponbatch.getMinOrderValue())==1 )
         {
        	 if(couponbatch.getCreaterType()==1)//平台券
        	 {
        		 Logger.comment("##### BatchCode: #####"+couponbatch.getBatchCode());
        		 //coupon 没有这个批次就需要重领
        		 Logger.comment("###########  验证bestCouponList platformCouponInfo ####################");
                 Logger.verifyEquals(couponbatch.getCouponValue().stripTrailingZeros().toPlainString(), return_best.getPlatformCouponInfo().getDeductionAmount().stripTrailingZeros().toPlainString(), "验证平台最优DeductionAmount");
                // Logger.verifyEquals(bean.getRules().get(0).getRuleId()==""?null:bean.getRules().get(0).getRuleId(), return_best.getPlatformCouponInfo().getRuleId(), "验证平台最优RuleId");
                 
                 Logger.verifyEquals(return_best.getPlatformCouponInfo().getRuleId()==null?null:bean.getRules().get(0).getRuleId(), return_best.getPlatformCouponInfo().getRuleId(), "验证平台最优RuleId");
                 
                 Logger.verifyEquals(bean.getRules().get(0).getMode(), return_best.getPlatformCouponInfo().getMode(), "验证平台最优Mode");
                 if(batchCode_other[0]==this.batchCode_receiveTimes2 || batchCode_other[0]==this.batchCode_newUser1 || batchCode_other[0]==this.batchCode_newUser2)
                 {
                	// if(coupons.get(0).getIsUsed()==true)
                	// {
                		 Logger.verifyEquals(coupons.size()==2?false:true, return_best.getPlatformCouponInfo().getNeedReceive(), "验证平台最优NeedReceive");
                	// }
                 }
                 else
                   Logger.verifyEquals(coupons.size()==0?true:false, return_best.getPlatformCouponInfo().getNeedReceive(), "验证平台最优NeedReceive");
        	 }
        	 else if(couponbatch.getCreaterType()==2)//买手券
        	 {
        		Logger.comment("###########  验证bestCouponList sellerCouponInfo ####################");
         	    Logger.verifyEquals(sellerbatchCall.get(0).getBatchCode(), return_best.getSellerCouponInfo().getBatchCode(), "验证买手最优batchCode");
                Logger.verifyEquals(sellerbatchBean.get(0).getBatchName(), return_best.getSellerCouponInfo().getCouponName(), "验证买手最优CouponName");
                //coupon 没有这个批次就需要重领
                Logger.verifyEquals(coupons.size()==0?true:false, return_best.getSellerCouponInfo().getNeedReceive(), "验证买手最优NeedReceive");
                Logger.verifyEquals(couponbatch.getMinOrderValue().stripTrailingZeros().toPlainString(), return_best.getSellerCouponInfo().getMeetAmount().stripTrailingZeros().toPlainString(), "验证买手最优MeetAmount");
                Logger.verifyEquals(couponbatch.getCouponValue().stripTrailingZeros().stripTrailingZeros().toPlainString(), return_best.getSellerCouponInfo().getDeductionAmount().stripTrailingZeros().toPlainString(), "验证买手最优DeductionAmount");
        	 }
         }
         Logger.comment("###########  验证availableCouponList ####################");
         //availableCouponList  第一个显示平台，第二个显示买手，若平台没有，则只显示买手；若买手没有，则只显示平台
         boolean isPlatform=false;
    	 int i=0;
         List<couponbatch> batchList=new ArrayList<couponbatch>();
         for(int k=1;k<=2;k++)
         {
        	 Map map = new HashMap();
    	     map.put("productPrice",bean.getActivityPriceList().get(0).getPrice());
    	     map.put("userId", bean.getBuyerId());
    	     map.put("createrType", k);//1平台 2买手
    	     if(batchCode_other.length>0)
    	     {
    	    	  map.put("batchCode", batchCode_other[0]); 
    	     }
    	     else if(sellerbatchCall.size()>0)
    	     {
    	    	 map.put("batchCode", sellerbatchCall.get(0).getBatchCode());
    	     }
    	    	 
             batchList=couponbatchWapper.getAvailableCouponList(map);
             if(k==1){ //平台  (是否界面显示)IsShowInPage=1可领取 0不可领取
             // if(batchList.size()>0 && batchList.get(0).getBatchCode().equals(this.batchCode))
            	if(batchList.size()>0)
            	{
            		 Logger.comment("##### BatchCode: #####"+couponbatch.getBatchCode());
            	     Logger.comment(" ##### 可领可用平台券 #######");
	            	 isPlatform=true; 
	            	 Logger.verifyEquals(batchList.get(0).getMinOrderValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getMeetAmount().stripTrailingZeros().toPlainString(), "验证可领取可使用列表中的MeetAmount");
	                 Logger.verifyEquals(batchList.get(0).getCouponValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getDeductionAmount().stripTrailingZeros().toPlainString(), "验证可领取可使用列表中的DeductionAmount");
	                 Logger.verifyEquals(batchList.get(0).getCreaterType(), return_availableList.get(i).getCreateType(), "验证可领取可使用列表中的CreateType为空");
            	}
             }
             if(k==2){ //买手
            	map.put("operatorId", bean.getSellerId());//1平台 2买手
            	map.put("isShowInPage", 1);
                batchList=couponbatchWapper.getAvailableCouponList(map);
               if(batchList.size()>0) 
            	{
            		Logger.comment("##### BatchCode: #####"+couponbatch.getBatchCode());
            	    Logger.comment(" ##### 可领可用买手券 #######");
            		//如果没有可领可用的平台券，仅显示买手券
            		if(isPlatform==true) i=1;
            		else i=0;
            		Logger.verifyEquals(batchList.get(0).getMinOrderValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getMeetAmount().stripTrailingZeros().toPlainString(), "验证可领取可使用列表中的MeetAmount");
	                Logger.verifyEquals(batchList.get(0).getCouponValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getDeductionAmount().stripTrailingZeros().toPlainString(), "验证可领取可使用列表中的DeductionAmount");
	                Logger.verifyEquals(batchList.get(0).getCreaterType(), return_availableList.get(i).getCreateType(), "验证可领取可使用列表中的CreateType为空");
            	} 
             }
         }
	}
	/**
	 * 1:平台使用规则 是ruleId_All="e0d889ac817a4c6ea9188baa4d909d11" , 批次是 NUVGKT1CKX  满1000000减9900
	 * 2:买手优惠券 满3000000 减3000
	 */
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_001() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-商品单价小于未领取的优惠券订单最小金额-买手-最优、可领列表不显示");
		try {

			this.DefaultSellerCreateBatchCall();
			bean=initGetProductBestCoupon(sellerCreateBatchBean.getSellerId(),this.ruleId_All);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(10));
			call.setData(bean);
			call.callService();			
			
			check_Empty();
            
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_002() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台券-商品单价小于未领取的优惠券订单最小金额-平台-最优、可领列表不显示");
		try {

//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(1000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(900));
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);

			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_All);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(10));
			call.setData(bean);
			call.callService();			
			
			check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_003() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-商品单价小于领取的优惠券订单最小金额-买手-最优不显示、可领列表不显示");
		try {

			this.DefaultSellerCreateBatchCall();
			bean=initGetProductBestCoupon(sellerCreateBatchBean.getSellerId(),this.ruleId_All);
            //领取
			couponMService.receiveCouponInfo(this.sellerCreateBatchCall.getBatchCode(), bean.getBuyerId());
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(10));
			call.setData(bean);
			call.callService();			
			
			check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_004() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台券-商品单价小于领取的优惠券订单最小金额-平台-最优不显示、可领列表不显示");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(1000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(900));
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_All);
            //领取
			couponMService.receiveCouponInfo(createCouponCall.getBatchCode(), bean.getBuyerId());
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(10));
			call.setData(bean);
			call.callService();			
			
			check_Empty();	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_005() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-商品单价大于未领取的优惠券订单最小金额-买手-最优显示、可领列表显示");
		try {
			this.DefaultSellerCreateBatchCall();
			bean=initGetProductBestCoupon(sellerCreateBatchBean.getSellerId(),"");
            //领取
			//couponMService.receiveCouponInfo(sellerbatchCall.getBatchCode(), bean.getBuyerId());
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(40000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(Arrays.asList(this.sellerCreateBatchBean),Arrays.asList(this.sellerCreateBatchCall));
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_006() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台券-商品单价大于未领取的订单最小金额-平台-最优显示、可领列表显示");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(1000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(800));
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);

			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_All);
            //领取
			//couponMService.receiveCouponInfo(sellerbatchCall.getBatchCode(), bean.getBuyerId());
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null,null,this.batchCode);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_007() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-商品单价大于领取的订单最小金额-买手-最优显示、可领列表显示");
		try {
			
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(580000));
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
			
			bean=initGetProductBestCoupon(sellerId,"");
            //领取
			couponMService.receiveCouponInfo(sellerCreateBatchCall1.getBatchCode(), bean.getBuyerId());
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(400000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(Arrays.asList(sellerCreateBatchBean1),Arrays.asList(sellerCreateBatchCall1));
				
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_008() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台券-商品单价大于领取的订单最小金额-平台-最优显示、可领列表显示");
		try {
			couponbatchWapper.setNoInvalid(this.batchCode);
			bean=initGetProductBestCoupon(this.operatorId,"");
            //领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), ruleId_All);
			//已领取过规则优惠券，就不再传ruleId,不再匹配规则
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(40000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null,null,this.batchCode);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_009() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-商品单价等于领取的订单最小金额-买手-最优显示、可领列表显示");
		try {
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			SellerCreateBatchBean sellerCreateBatchBean=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean.setSellerId(sellerId);
			sellerCreateBatchBean.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean.setCouponAmount(new BigDecimal(580000));
			SellerCreateBatchCall sellerCreateBatchCall=couponMService.SellerCreateBatch(sellerCreateBatchBean);
			
			bean=initGetProductBestCoupon(sellerId,"");
            //领取
			couponMService.receiveCouponInfo(sellerCreateBatchCall.getBatchCode(), bean.getBuyerId());
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(Arrays.asList(sellerCreateBatchBean),Arrays.asList(sellerCreateBatchCall));		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_010() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台券-商品单价等于领取的订单最小金额-平台-最优显示、可领列表显示");
		try {
			couponbatchWapper.setNoInvalid(this.batchCode);
			bean=initGetProductBestCoupon(this.operatorId,"");
            //领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), ruleId_All);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null,null,this.batchCode);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_011() {
		Logger.start(true,"商详最优的买手券和平台券-验证新人优惠券(新人优惠券无规则ID)-最优显示、可领列表显示");
		try {

			bean=initGetProductBestCoupon(this.operatorId,"");
			bean.getRules().get(0).setMode(1);//0 = 平台优惠券   1 = 新人优惠券
			bean.getRules().get(0).setUserType(1000);//1000黄牛券 1001新人首次 A券 1002新人第二次A券
            //领取
			//couponMService.receiveCouponInfo(this.batchCode, bean.getBuyerId());
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(4000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null,null,this.batchCode_newUser1);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_011_1() {
		Logger.start(true,"商详最优的买手券和平台券-验证新人优惠券(新人优惠券无规则ID)-新人领取1次-最优显示、可领列表显示");
		try {

			bean=initGetProductBestCoupon(this.operatorId,"");
			bean.getRules().get(0).setMode(1);//0 = 平台优惠券   1 = 新人优惠券
			bean.getRules().get(0).setUserType(1000);//1000黄牛券 1001新人首次 A券 1002新人第二次A券
            //领取
			couponMService.receiveCouponInfo(this.batchCode_newUser1, bean.getBuyerId());
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(4000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null,null,this.batchCode_newUser1);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_011_2() {
		Logger.start(true,"商详最优的买手券和平台券-验证新人优惠券(新人优惠券无规则ID)-新人领取2次-最优显示、可领列表显示");
		try {

			bean=initGetProductBestCoupon(this.operatorId,"");
			bean.getRules().get(0).setMode(1);//0 = 平台优惠券   1 = 新人优惠券
			bean.getRules().get(0).setUserType(1002);//1000黄牛券 1001新人首次 A券 1002新人第二次A券
            //领取
			couponMService.receiveCouponInfo(this.batchCode_newUser2, bean.getBuyerId());
			couponMService.receiveCouponInfo(this.batchCode_newUser2, bean.getBuyerId());
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(4000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null,null,this.batchCode_newUser2);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_012() {
		Logger.start(true,"商详最优的买手券和平台券-验证productId与平台优惠券指定的商品Id不一致-未领取-最优、可领列表不显示");
		try {
			
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(2000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(299999));
//			List<String> list = new ArrayList<String>();
//            list.add("productId999");
//            createCouponBean.setProductIds(list);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_productId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setProductId(this.productId+1);
			call.setData(bean);
			call.callService();	

			check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_013() {
		Logger.start(true,"商详最优的买手券和平台券-验证productId与平台优惠券指定的商品Id不一致-领取-最优显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_productId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setProductId(this.productId+1);
			call.setData(bean);
			call.callService();	

			check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_014() {
		Logger.start(true,"商详最优的买手券和平台券-验证productId与平台优惠券指定的商品Id一致-未领取-最优显示、可领列表显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_productId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setProductId(this.productId);
			call.setData(bean);
			call.callService();	

			check_verify(null, null, this.batchCode_productId);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_015() {
		Logger.start(true,"商详最优的买手券和平台券-验证productId与平台优惠券指定的商品Id一致-领取-最优显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_productId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setProductId(this.productId);
			call.setData(bean);
			call.callService();	

			check_verify(null, null, this.batchCode_productId);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_016() {
		Logger.start(true,"商详最优的买手券和平台券-验证类目一级与平台优惠券指定的一级一致-领取-最优显示、可领列表显示");
		try {
//			
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(2000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(299999));
//			List<Integer> list = new ArrayList<Integer>();
//            list.add(1001);
//            createCouponBean.setCategories(list);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_categoriesId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			List<Integer> categoryIds=new ArrayList();
			categoryIds.add(this.categoriesId);
			categoryIds.add(1002);
			categoryIds.add(1003);
			bean.setCategoryIds(categoryIds);
			
			call.setData(bean);
			call.callService();	

			check_verify(null, null, this.batchCode_categories);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_017() {
		Logger.start(true,"商详最优的买手券和平台券-验证类目一级与平台优惠券指定的一级不一致-未领取-最优、可领列表不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_categoriesId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			List<Integer> categoryIds=new ArrayList();
			categoryIds.add(10001);
			categoryIds.add(1002);
			categoryIds.add(1003);
			bean.setCategoryIds(categoryIds);
			call.setData(bean);
			call.callService();		
			
			check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_018() {
		Logger.start(true,"商详最优的买手券和平台券-验证类目一级与平台优惠券指定的一级不一致-领取最优不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_categoriesId);
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_categoriesId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			List<Integer> categoryIds=new ArrayList();
			categoryIds.add(10001);
			categoryIds.add(1002);
			categoryIds.add(1003);
			bean.setCategoryIds(categoryIds);
			call.setData(bean);
			call.callService();	
			
			this.check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_019() {
		Logger.start(true,"商详最优的买手券和平台券-验证类目二级与平台优惠券指定的一级一致-领取-最优显示、可领列表不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_categoriesId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			List<Integer> categoryIds=new ArrayList();
			categoryIds.add(10001);
			categoryIds.add(this.categoriesId);
			categoryIds.add(1003);
			bean.setCategoryIds(categoryIds);
			call.setData(bean);
			call.callService();	
			
			check_verify(null, null, this.batchCode_categories);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_020() {
		Logger.start(true,"商详最优的买手券和平台券-验证类目三级与平台优惠券指定的一级一致-领取-最优显示、可领列表不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_categoriesId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			List<Integer> categoryIds=new ArrayList();
			categoryIds.add(10001);
			categoryIds.add(1002);
			categoryIds.add(this.categoriesId);
			bean.setCategoryIds(categoryIds);
			call.setData(bean);
			call.callService();	
			
			check_verify(null, null, this.batchCode_categories);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_021() {
		Logger.start(true,"商详最优的买手券和平台券-验证品牌与平台优惠券指定的品牌一致-未领取-最优显示、可领列表显示");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(2000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(299999));
//			List<Integer> list = new ArrayList<Integer>();
//            list.add(500);
//            createCouponBean.setBrands(list);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_brandId);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setBrandId(this.brandId);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_brandId);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_022() {
		Logger.start(true,"商详最优的买手券和平台券-验证品牌与平台优惠券指定的品牌一致-领取-最优显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_brandId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setBrandId(this.brandId);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_brandId);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_023() {
		Logger.start(true,"商详最优的买手券和平台券-验证品牌与平台优惠券指定的品牌不一致-未领取-最优、可领列表不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_brandId);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_brandId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setBrandId(this.brandId+1);
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_024() {
		Logger.start(true,"商详最优的买手券和平台券-验证品牌与平台优惠券指定的品牌不一致-领取-最优、可领列表不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_brandId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setBrandId(this.brandId+1);
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_025() {
		Logger.start(true,"商详最优的买手券和平台券-验证国家与平台优惠券指定的国家一致-未领取-最优显示、可领列表显示");
		try {
			
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(2000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(299999));
//			List<Integer> list = new ArrayList<Integer>();
//            list.add(10);
//            createCouponBean.setCountrys(list);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_countryId);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_countryId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setCountryId(this.countryId);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_countryId);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_026() {
		Logger.start(true,"商详最优的买手券和平台券-验证国家与平台优惠券指定的国家一致-领取-最优显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_countryId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setCountryId(this.countryId);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_countryId);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_027() {
		Logger.start(true,"商详最优的买手券和平台券-验证国家与平台优惠券指定的国家不一致-未领取-最优、可领列表不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_countryId);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_countryId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setCountryId(this.countryId+1);
			call.setData(bean);
			call.callService();		
			
		   this.check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_028() {
		Logger.start(true,"商详最优的买手券和平台券-验证国家与平台优惠券指定的国家不一致-领取-最优不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_countryId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			bean.setCountryId(this.countryId+1);
			call.setData(bean);
			call.callService();		
			
		   this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_029() {
		Logger.start(true,"商详最优的买手券和平台券-验证价格活动列表-活动Id和价格有满足-未领取-最优显示、可领列表显示");
		try {
			
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(2200000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(299999));
//			List<Integer> list = new ArrayList<Integer>();
//            list.add(11);
//            createCouponBean.setActivityIds(list);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_activityId);
			List<ActivityPriceDto> activityPriceList=new ArrayList();
			ActivityPriceDto activityPriceDto=new ActivityPriceDto();
			activityPriceDto.setActivityId(this.activityId);//不允许更改
			activityPriceDto.setPrice(new BigDecimal(1));
			activityPriceDto.setDisplay(true);
			activityPriceList.add(activityPriceDto);
			bean.setActivityPriceList(activityPriceList);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_activityId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_activityId);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_030() {
		Logger.start(true,"商详最优的买手券和平台券-验证价格活动列表-活动Id和价格有满足-领取-最优显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			List<ActivityPriceDto> activityPriceList=new ArrayList();
			ActivityPriceDto activityPriceDto=new ActivityPriceDto();
			activityPriceDto.setActivityId(this.activityId);//不允许更改
			activityPriceDto.setPrice(new BigDecimal(1));
			activityPriceDto.setDisplay(true);
			activityPriceList.add(activityPriceDto);
			bean.setActivityPriceList(activityPriceList);
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_activityId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_activityId);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_031() {
		Logger.start(true,"商详最优的买手券和平台券-验证价格活动列表-活动Id和价格没有满足-未领取-最优、可领列表不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_activityId);
			
			List<ActivityPriceDto> activityPriceList=new ArrayList();
			ActivityPriceDto activityPriceDto=new ActivityPriceDto();
			activityPriceDto.setActivityId(this.activityId+1);//不允许更改
			activityPriceDto.setPrice(new BigDecimal(1));
			activityPriceDto.setDisplay(true);
			activityPriceList.add(activityPriceDto);
			
			bean.setActivityPriceList(activityPriceList);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_activityId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_032() {
		Logger.start(true,"商详最优的买手券和平台券-验证价格活动列表-活动Id和价格没有满足-领取-最优、可领列表不显示");
		try {
			
            bean=initGetProductBestCoupon(this.operatorId,"");
			
			List<ActivityPriceDto> activityPriceList=new ArrayList();
			ActivityPriceDto activityPriceDto=new ActivityPriceDto();
			activityPriceDto.setActivityId(this.activityId+1);//不允许更改
			activityPriceDto.setPrice(new BigDecimal(1));
			activityPriceDto.setDisplay(true);
			activityPriceList.add(activityPriceDto);
			
			bean.setActivityPriceList(activityPriceList);
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_activityId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_033() {
		Logger.start(true,"商详最优的买手券和平台券-验证是优选商品-未领取-最优显示、可领列表显示");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(2300000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(239999));
//
//            createCouponBean.setIsLimitPspProduct(true);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
	
			 bean=initGetProductBestCoupon(this.operatorId,this.ruleId_isPsp);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isPsp);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPsp(this.isPsp);
			call.setData(bean);
			call.callService();			
			
			check_verify(null, null, this.batchCode_isPsp);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_034() {
		Logger.start(true,"商详最优的买手券和平台券-验证是优选商品-领取-最优显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isPsp);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPsp(this.isPsp);
			call.setData(bean);
			call.callService();			
			
			check_verify(null, null, this.batchCode_isPsp);				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_035() {
		Logger.start(true,"商详最优的买手券和平台券-验证不是优选商品-优惠券是优选商品-未领取-最优、可领列表不显示");
		try {
			 bean=initGetProductBestCoupon(this.operatorId,this.ruleId_isPsp);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isPsp);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPsp(false);
			call.setData(bean);
			call.callService();			
			
			this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_036() {
		Logger.start(true,"商详最优的买手券和平台券-验证不是优选商品-领取-最优、可领列表不显示");
		try {
			 bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isPsp);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPsp(false);
			call.setData(bean);
			call.callService();			
			
			this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_037() {
		Logger.start(true,"商详最优的买手券和平台券-验证可以使用团长券-未领取-最优显示、可领列表显示");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(4000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(3000000));
//
//            createCouponBean.setIsLimitGroupSponsor(true);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			 bean=initGetProductBestCoupon(this.operatorId,this.ruleId_isGroup);
			//领取
		//	this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isPsp);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setUseCommander(this.isGroup);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_isGroup);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_038() {
		Logger.start(true,"商详最优的买手券和平台券-验证可以使用团长券-领取-最优显示");
		try {
			 bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isGroup);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setUseCommander(this.isGroup);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_isGroup);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_039() {
		Logger.start(true,"商详最优的买手券和平台券-验证不可以使用团长券-未领取-最优、可领列表不显示");
		try {
			
			 bean=initGetProductBestCoupon(this.operatorId,this.ruleId_isGroup);
			//领取
		//	this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isGroup);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setUseCommander(false);
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_040() {
		Logger.start(true,"商详最优的买手券和平台券-验证不可以使用团长券-领取-最优、可领列表不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_isGroup);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setUseCommander(false);
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_042() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台来源platformSource=0-C2C,优惠券来源C2C-未领取-最优显示");
		try {
			
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(4000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(3000000));
//
//            createCouponBean.setPlatformSource(0);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_platformSource0);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_platformSource0);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPlatformSource(this.platformSource0);
			call.setData(bean);
			call.callService();				
			
			check_verify(null, null, this.batchCode_platformSource0);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_043() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台来源platformSource=0-C2C,优惠券来源C2C-领取-最有显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_platformSource0);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPlatformSource(this.platformSource0);
			call.setData(bean);
			call.callService();				
			
			check_verify(null, null, this.batchCode_platformSource0);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_044() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台来源platformSource=1-全球优选,优惠券来源全球优选-未领取最优显示");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(4000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(3000000));
//
//            createCouponBean.setPlatformSource(1);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_platformSource1);
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_platformSource0);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPlatformSource(this.platformSource1);
			call.setData(bean);
			call.callService();				
			
			check_verify(null, null, this.batchCode_platformSource1);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_045() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台来源platformSource=1-全球优选,优惠券来源全球优选-领取-最优显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_platformSource1);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			bean.setPlatformSource(this.platformSource1);
			call.setData(bean);
			call.callService();				
			
			check_verify(null, null, this.batchCode_platformSource1);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_046() {
		//此接口不能重复使用，因为要创建规则
		Logger.start(true,"商详最优的买手券和平台券-验证优惠券批次只能领取1次,但当前子批次有一张已经使用了,最优、可领可用不显示该优惠券");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
			//查询
			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode).get(0);
			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
			//使用优惠券
			this.couponMService.UseCoupon(bean.getBuyerId(), coupon.getCouponCode());
			Thread.sleep(5000);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			
			call.setData(bean);
			call.callService();	
			
			this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_047() {
		Logger.start(true,"商详最优的买手券和平台券-验证优惠券批次只能领取1次,但当前子批次有一张领取未使用-最优显示,可领列表不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
//			//查询
//			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode).get(0);
//			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
//			//使用优惠券
//			this.couponMService.UseCoupon(bean.getBuyerId(), coupon.getCouponCode());
			Thread.sleep(5000);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			
			call.setData(bean);
			call.callService();	
			
			check_verify(null, null, this.batchCode);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_048() {
		Logger.start(true,"商详最优的买手券和平台券-验证优惠券批次只能领取2次,但当前子批次有一张已经使用了,最优、可领列表显示");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(4000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(3000000));
//
//            createCouponBean.setPerUserReceiveMaxCount(2);
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_receiveTimes2);
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_receiveTimes2);
			//查询
			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode_receiveTimes2).get(0);
			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
			//使用优惠券
			this.couponMService.UseCoupon(bean.getBuyerId(), coupon.getCouponCode());
			Thread.sleep(5000);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			
			call.setData(bean);
			call.callService();	
			
			check_verify(null, null, this.batchCode_receiveTimes2);	
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_049() {
		Logger.start(true,"商详最优的买手券和平台券-验证优惠券批次只能领取2次,但当前子批次有一张领取未使用,最优、可领列表显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_receiveTimes2);
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_receiveTimes2);
//			//查询
//			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode_receiveTimes2).get(0);
//			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
//			//使用优惠券
//			this.couponMService.UseCoupon(bean.getBuyerId(), coupon.getCouponCode());
			Thread.sleep(5000);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(5000000));
			
			call.setData(bean);
			call.callService();	
			
			check_verify(null, null, this.batchCode_receiveTimes2);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_050() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-2张可用优惠券，1未领取,立减面额大;1领取,立减面额小-最优、可领可用显示未领取面额大");
		try {
			
			Integer userId=TestDataManager.getRandomIntNum(10);
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			//1未领取,立减面额大
			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(590000));
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
			//领取,立减面额小
			SellerCreateBatchBean sellerCreateBatchBean2=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean2.setSellerId(sellerId);
			sellerCreateBatchBean2.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean2.setCouponAmount(new BigDecimal(580000));
			SellerCreateBatchCall sellerCreateBatchCall2=couponMService.SellerCreateBatch(sellerCreateBatchBean2);
			//领取
			couponMService.receiveCouponInfo(sellerCreateBatchCall2.getBatchCode(), userId);
			
			bean=initGetProductBestCoupon(sellerId,"");
			bean.setBuyerId(userId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(700000));
			
			call.setData(bean);
			call.callService();			
			
			check_verify(Arrays.asList(sellerCreateBatchBean1),Arrays.asList(sellerCreateBatchCall1));
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_051() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台券-2张可用优惠券，1未领取,立减面额大;1领取,立减面额小-最优显示未领取面额大");
		try {
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(4000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(3800000));
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
//			
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(4000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(3900000));
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			List<RuleDto> rules=new ArrayList();
			RuleDto ruleDto=new RuleDto();
			//ruleDto.setRuleId(this.ruleId_two_4000000_3900000);//领券规则id（新人优惠券无规则ID）
			ruleDto.setMode(0);//0 = 平台优惠券 1=新人优惠券
			ruleDto.setUserType(2);//2未下单会员,8已下单会员 32普通 64白银 128黄金 256铂金 512钻石 1024黑卡 2048非安利会员/大人 4096安利会员 8192安利达人 16黄牛
			rules.add(ruleDto);
			bean.setRules(rules);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_two_4000000_3900000);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_two_4000000_3900000);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_052() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-2张可用优惠券，1未领取,立减面额小;1领取,立减面额大-最优显示已领取面额大，可领列表显示未领取的优惠券");
		try {
			Integer userId=TestDataManager.getRandomIntNum(10);
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			//1未领取,立减面额小
			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(580000));
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
			//领取,立减面额大
			SellerCreateBatchBean sellerCreateBatchBean2=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean2.setSellerId(sellerId);
			sellerCreateBatchBean2.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean2.setCouponAmount(new BigDecimal(590000));
			SellerCreateBatchCall sellerCreateBatchCall2=couponMService.SellerCreateBatch(sellerCreateBatchBean2);
			//领取
			couponMService.receiveCouponInfo(sellerCreateBatchCall2.getBatchCode(), userId);
			
			bean=initGetProductBestCoupon(sellerId,"");
			bean.setBuyerId(userId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			
			call.setData(bean);
			call.callService();			
			
			check_verify(Arrays.asList(sellerCreateBatchBean2),Arrays.asList(sellerCreateBatchCall2));	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_053() {
		Logger.start(true,"商详最优的买手券和平台券-验证平台券-2张可用优惠券，1未领取,立减面额小;1领取,立减面额大-最优显示已领取面额大，可领列表显示未领取的优惠券");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			List<RuleDto> rules=new ArrayList();
			RuleDto ruleDto=new RuleDto();
			ruleDto.setRuleId(this.ruleId_two_4000000_3800000);//领券规则id（新人优惠券无规则ID）
			ruleDto.setMode(0);//0 = 平台优惠券 1=新人优惠券
			ruleDto.setUserType(2);//2未下单会员,8已下单会员 32普通 64白银 128黄金 256铂金 512钻石 1024黑卡 2048非安利会员/大人 4096安利会员 8192安利达人 16黄牛
			rules.add(ruleDto);
			bean.setRules(rules);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_two_4000000_3900000);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, this.batchCode_two_4000000_3900000);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	//@Ignore
	public void Tc_GetProductBestCoupon_054() {
		Logger.start(true,"商详最优的买手券和平台券-验证满足条件-平台券-已领取-可领列表不显示(前面case包含)");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(700000000));
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_All);
			call.setData(bean);
			call.callService();			
			
			check_verify(null, null, this.batchCode);	
			Logger.verifyEquals(0, call.getAvailableCouponList().getAvailableCouponList().size(), "验证可领可用集合为空");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_055() {
		Logger.start(true,"商详最优的买手券和平台券-验证满足条件-买手券-已领取-可领列表不显示");
		try {
			
			Integer userId=TestDataManager.getRandomIntNum(10);
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(580000));
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
			//领取
			couponMService.receiveCouponInfo(sellerCreateBatchCall1.getBatchCode(), userId);
			
			bean=initGetProductBestCoupon(sellerId,"");
			bean.setBuyerId(userId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			
			call.setData(bean);
			call.callService();			
			
			check_verify(Arrays.asList(sellerCreateBatchBean1),Arrays.asList(sellerCreateBatchCall1));		
			Logger.verifyEquals(0, call.getAvailableCouponList().getAvailableCouponList().size(), "验证可领可用集合为空");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_056() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手券-验证3张平台券满足-1未领取平台券面额最小,2张领取-最优显示最大面额,可领取列表显示未领1张");
		try {
			
//			createCouponBean = couponMService.setDefaultPlatformCreateCouponBeanForRecieve();
//			createCouponBean.getCouponValues().get(0).setOrderMinAmount(new BigDecimal(4000000));
//			createCouponBean.getCouponValues().get(0).setDeductionMaxAmount(new BigDecimal(3700000));
//			createCouponCall=couponMService.createPlatformCoupon(createCouponBean);
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			List<RuleDto> rules=new ArrayList();
			RuleDto ruleDto=new RuleDto();
			ruleDto.setRuleId(this.ruleId_two_4000000_3700000);//领券规则id（新人优惠券无规则ID）
			ruleDto.setMode(0);//0 = 平台优惠券 1=新人优惠券
			ruleDto.setUserType(2);//2未下单会员,8已下单会员 32普通 64白银 128黄金 256铂金 512钻石 1024黑卡 2048非安利会员/大人 4096安利会员 8192安利达人 16黄牛
			rules.add(ruleDto);
			bean.setRules(rules);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_two_4000000_3800000);
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_two_4000000_3900000);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, batchCode_two_4000000_3900000);			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_057() {
		Logger.start(true,"商详最优的买手券和平台券-验证3张平台券满足-1已领取平台券面额最大,2张未领取-最优显示最大面额,可领取列表显示1张未领取中面额最大的");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			List<RuleDto> rules=new ArrayList();
			RuleDto ruleDto=new RuleDto();
			ruleDto.setRuleId(this.ruleId_two_4000000_3700000);//领券规则id（新人优惠券无规则ID）
			ruleDto.setMode(0);//0 = 平台优惠券 1=新人优惠券
			ruleDto.setUserType(2);//2未下单会员,8已下单会员 32普通 64白银 128黄金 256铂金 512钻石 1024黑卡 2048非安利会员/大人 4096安利会员 8192安利达人 16黄牛
			rules.add(ruleDto);
			
			ruleDto=new RuleDto();
			ruleDto.setRuleId(this.ruleId_two_4000000_3800000);//领券规则id（新人优惠券无规则ID）
			ruleDto.setMode(0);//0 = 平台优惠券 1=新人优惠券
			ruleDto.setUserType(2);//2未下单会员,8已下单会员 32普通 64白银 128黄金 256铂金 512钻石 1024黑卡 2048非安利会员/大人 4096安利会员 8192安利达人 16黄牛
			rules.add(ruleDto);
			
			bean.setRules(rules);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_two_4000000_3900000);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, batchCode_two_4000000_3900000);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_058() {
		Logger.start(true,"商详最优的买手券和平台券-验证3张平台券满足-1未领取平台券面额最大,2张已领取-最优显示最大面额,可领取列表为空");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			List<RuleDto> rules=new ArrayList();
			RuleDto ruleDto=new RuleDto();
			ruleDto.setRuleId(this.ruleId_two_4000000_3900000);//领券规则id（新人优惠券无规则ID）
			ruleDto.setMode(0);//0 = 平台优惠券 1=新人优惠券
			ruleDto.setUserType(2);//2未下单会员,8已下单会员 32普通 64白银 128黄金 256铂金 512钻石 1024黑卡 2048非安利会员/大人 4096安利会员 8192安利达人 16黄牛
			rules.add(ruleDto);
			bean.setRules(rules);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_two_4000000_3800000);
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_two_4000000_3700000);
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, batchCode_two_4000000_3900000);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_059() {
		Logger.start(true,"商详最优的买手券和平台券-验证1平台2买手-1未领取平台券面额最大,2买手已领取-最优显示最大面额,可领取列表1未领取平台券");
		try {
			//平台优惠券
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_two_4000000_3900000);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));	
			//买手优惠券1
			Integer userId=bean.getBuyerId();
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(4000000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(3600000));
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
			//买手优惠券2
			SellerCreateBatchBean sellerCreateBatchBean2=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean2.setSellerId(sellerId);
			sellerCreateBatchBean2.setOrderMinAmount(new BigDecimal(4000000));
			sellerCreateBatchBean2.setCouponAmount(new BigDecimal(3700000));
			SellerCreateBatchCall sellerCreateBatchCall2=couponMService.SellerCreateBatch(sellerCreateBatchBean2);
			//领取2买手
			couponMService.receiveCouponInfo(sellerCreateBatchCall1.getBatchCode(), userId);
			couponMService.receiveCouponInfo(sellerCreateBatchCall2.getBatchCode(), userId);
			
			call.setData(bean);
			call.callService();		
			
			check_verify(null, null, batchCode_two_4000000_3900000);	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_060() {
		Logger.start(true,"商详最优的买手券和平台券-验证1张平台2张买手-1未领取平台券面额最大,买手1张最小已领取-最优显示最大面额,可领取列表为未领取平台券");
		try {
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			//平台优惠券
			bean=initGetProductBestCoupon(sellerId,this.ruleId_two_4000000_3900000);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));	
			//买手优惠券1
			Integer userId=bean.getBuyerId();

			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(4000000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(3600000));
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
			//买手优惠券2
			SellerCreateBatchBean sellerCreateBatchBean2=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean2.setSellerId(sellerId);
			sellerCreateBatchBean2.setOrderMinAmount(new BigDecimal(4000000));
			sellerCreateBatchBean2.setCouponAmount(new BigDecimal(3700000));
			SellerCreateBatchCall sellerCreateBatchCall2=couponMService.SellerCreateBatch(sellerCreateBatchBean2);
			//领取2买手
			couponMService.receiveCouponInfo(sellerCreateBatchCall1.getBatchCode(), userId);
			
			call.setData(bean);
			call.callService();		
			//验证
			 String batchCode="";
			 Logger.verifyEquals("0", call.getStatusCode1(), "验证返回Code");
	         Logger.verifyEquals("操作成功！",call.getMessage(), "验证返回Message");
	         
	         bestCoupon resp_best=call.getBestCouponList();
	         availableCoupon resp_available=call.getAvailableCouponList();
	         
	         BestCouponInfo return_best=resp_best.getBestCouponList().get(0);
	         List<AvailableCouponInfo> return_availableList=resp_available.getAvailableCouponList();
	         
	         Logger.verifyEquals(bean.getActivityPriceList().get(0).getActivityId(), return_best.getActivityId(), "验证返回activityId与传入一致");
	         Logger.verifyEquals(bean.getActivityPriceList().get(0).getPrice(), return_best.getPrice(), "验证返回price与传入一致");
	         //sellerCouponInfo
	         Logger.comment("###########  验证bestCouponList ####################");

	         couponbatch couponbatch=couponbatchWapper.selectBybatchCode(this.batchCode_two_4000000_3900000).get(0);
	         List<coupon> coupons=couponWapper.selectByBatchIdAndUserId(couponbatch.getBatchId(),bean.getBuyerId());
	         
	         if(bean.getActivityPriceList().get(0).getPrice().compareTo(couponbatch.getMinOrderValue())==1 )
	         {
	        	 if(couponbatch.getCreaterType()==1)//平台券
	        	 {
	        		 Logger.comment("##### BatchCode: #####"+couponbatch.getBatchCode());
	        		 //coupon 没有这个批次就需要重领
	        		 Logger.comment("###########  验证bestCouponList platformCouponInfo ####################");
	                 Logger.verifyEquals(couponbatch.getCouponValue().stripTrailingZeros().toPlainString(), return_best.getPlatformCouponInfo().getDeductionAmount().stripTrailingZeros().toPlainString(), "验证平台最优DeductionAmount");
	                // Logger.verifyEquals(bean.getRules().get(0).getRuleId()==""?null:bean.getRules().get(0).getRuleId(), return_best.getPlatformCouponInfo().getRuleId(), "验证平台最优RuleId");
	                 
	                 Logger.verifyEquals(return_best.getPlatformCouponInfo().getRuleId()==null?null:bean.getRules().get(0).getRuleId(), return_best.getPlatformCouponInfo().getRuleId(), "验证平台最优RuleId");
	                 
	                 Logger.verifyEquals(bean.getRules().get(0).getMode(), return_best.getPlatformCouponInfo().getMode(), "验证平台最优Mode");
	                 
	                 Logger.verifyEquals(coupons.size()==0?true:false, return_best.getPlatformCouponInfo().getNeedReceive(), "验证平台最优NeedReceive");
	        	 }
	        	 else if(couponbatch.getCreaterType()==2)//买手券
	        	 {
	        		Logger.comment("###########  验证bestCouponList sellerCouponInfo ####################");
	         	    Logger.verifyEquals(sellerCreateBatchCall2.getBatchCode(), return_best.getSellerCouponInfo().getBatchCode(), "验证买手最优batchCode");
	                Logger.verifyEquals(sellerCreateBatchBean2.getBatchName(), return_best.getSellerCouponInfo().getCouponName(), "验证买手最优CouponName");
	                //coupon 没有这个批次就需要重领
	                Logger.verifyEquals(coupons.size()==0?true:false, return_best.getSellerCouponInfo().getNeedReceive(), "验证买手最优NeedReceive");
	                Logger.verifyEquals(couponbatch.getMinOrderValue().stripTrailingZeros().toPlainString(), return_best.getSellerCouponInfo().getMeetAmount().stripTrailingZeros().toPlainString(), "验证买手最优MeetAmount");
	                Logger.verifyEquals(couponbatch.getCouponValue().stripTrailingZeros().stripTrailingZeros().toPlainString(), return_best.getSellerCouponInfo().getDeductionAmount().stripTrailingZeros().toPlainString(), "验证买手最优DeductionAmount");
	        	 }
	         }
	         Logger.comment("###########  验证availableCouponList ####################");
	         //availableCouponList  第一个显示平台，第二个显示买手，若平台没有，则只显示买手；若买手没有，则只显示平台
	         boolean isPlatform=false;
	    	 int i=0;
	         List<couponbatch> batchList=new ArrayList<couponbatch>();
	         for(int k=1;k<=2;k++)
	         {
	        	 Map map = new HashMap();
	    	     map.put("productPrice",bean.getActivityPriceList().get(0).getPrice());
	    	     map.put("userId", bean.getBuyerId());
	    	     map.put("createrType", k);//1平台 2买手
	    	     map.put("batchCode", this.batchCode_two_4000000_3900000); 

	             batchList=couponbatchWapper.getAvailableCouponList(map);
	             if(k==1){ //平台  (是否界面显示)IsShowInPage=1可领取 0不可领取
	              if(batchList.size()>0 )
	            	{
	            		 Logger.comment("##### BatchCode: #####"+couponbatch.getBatchCode());
	            	     Logger.comment(" ##### 可领可用平台券 #######");
		            	 isPlatform=true; 
		            	 Logger.verifyEquals(batchList.get(0).getMinOrderValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getMeetAmount().stripTrailingZeros().toPlainString(), "验证平台可领取可使用列表中的MeetAmount");
		                 Logger.verifyEquals(batchList.get(0).getCouponValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getDeductionAmount().stripTrailingZeros().toPlainString(), "验证平台可领取可使用列表中的DeductionAmount");
		                 Logger.verifyEquals(batchList.get(0).getCreaterType(), return_availableList.get(i).getCreateType(), "验证平台可领取可使用列表中的CreateType=1");
		                 i++;
	            	}
	             }
	             if(k==2){ //买手
	            	map.put("operatorId", bean.getSellerId());//1平台 2买手
	            	map.put("isShowInPage", 1);
	            	map.put("batchCode",sellerCreateBatchCall2.getBatchCode() ); 
	                batchList=couponbatchWapper.getAvailableCouponList(map);
	               if(batchList.size()>0) 
	            	{
	            		Logger.comment("##### BatchCode: #####"+batchList.get(0).getBatchCode());
	            	    Logger.comment(" ##### 可领可用买手券 #######");
	            		//如果没有可领可用的平台券，仅显示买手券
	            		if(isPlatform==true) i=1;
	            		else i=0;
	            		Logger.verifyEquals(batchList.get(0).getMinOrderValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getMeetAmount().stripTrailingZeros().toPlainString(), "验证买手可领取可使用列表中的MeetAmount");
		                Logger.verifyEquals(batchList.get(0).getCouponValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getDeductionAmount().stripTrailingZeros().toPlainString(), "验证买手可领取可使用列表中的DeductionAmount");
		                Logger.verifyEquals(batchList.get(0).getCreaterType(), return_availableList.get(i).getCreateType(), "验证买手可领取可使用列表中的CreateType=2");
	            	} 
	             }
	         }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_060_1() {
		Logger.start(true,"商详最优的买手券和平台券-验证1张平台2张买手-1未领取平台券面额最大,买手1张最大已领取-最优显示最大面额,可领取列表为未领取平台券");
		try {
			Integer sellerId=TestDataManager.getRandomIntNum(10);
			
			//平台优惠券
			bean=initGetProductBestCoupon(sellerId,this.ruleId_two_4000000_3900000);
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));	
			//买手优惠券1
			Integer userId=bean.getBuyerId();

			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(4000000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(3600000));
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
			//买手优惠券2
			SellerCreateBatchBean sellerCreateBatchBean2=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean2.setSellerId(sellerId);
			sellerCreateBatchBean2.setOrderMinAmount(new BigDecimal(4000000));
			sellerCreateBatchBean2.setCouponAmount(new BigDecimal(3700000));
			SellerCreateBatchCall sellerCreateBatchCall2=couponMService.SellerCreateBatch(sellerCreateBatchBean2);
			//领取2买手
			couponMService.receiveCouponInfo(sellerCreateBatchCall1.getBatchCode(), userId);
			
			call.setData(bean);
			call.callService();		
			
			//验证
			 String batchCode="";
			 Logger.verifyEquals("0", call.getStatusCode1(), "验证返回Code");
	         Logger.verifyEquals("操作成功！",call.getMessage(), "验证返回Message");
	         
	         bestCoupon resp_best=call.getBestCouponList();
	         availableCoupon resp_available=call.getAvailableCouponList();
	         
	         BestCouponInfo return_best=resp_best.getBestCouponList().get(0);
	         List<AvailableCouponInfo> return_availableList=resp_available.getAvailableCouponList();
	         
	         Logger.verifyEquals(bean.getActivityPriceList().get(0).getActivityId(), return_best.getActivityId(), "验证返回activityId与传入一致");
	         Logger.verifyEquals(bean.getActivityPriceList().get(0).getPrice(), return_best.getPrice(), "验证返回price与传入一致");
	         //sellerCouponInfo
	         Logger.comment("###########  验证bestCouponList ####################");

	         couponbatch couponbatch=couponbatchWapper.selectBybatchCode(this.batchCode_two_4000000_3900000).get(0);
	         List<coupon> coupons=couponWapper.selectByBatchIdAndUserId(couponbatch.getBatchId(),bean.getBuyerId());
	         
	         if(bean.getActivityPriceList().get(0).getPrice().compareTo(couponbatch.getMinOrderValue())==1 )
	         {
	        	 if(couponbatch.getCreaterType()==1)//平台券
	        	 {
	        		 Logger.comment("##### BatchCode: #####"+couponbatch.getBatchCode());
	        		 //coupon 没有这个批次就需要重领
	        		 Logger.comment("###########  验证bestCouponList platformCouponInfo ####################");
	                 Logger.verifyEquals(couponbatch.getCouponValue().stripTrailingZeros().toPlainString(), return_best.getPlatformCouponInfo().getDeductionAmount().stripTrailingZeros().toPlainString(), "验证平台最优DeductionAmount");
	                // Logger.verifyEquals(bean.getRules().get(0).getRuleId()==""?null:bean.getRules().get(0).getRuleId(), return_best.getPlatformCouponInfo().getRuleId(), "验证平台最优RuleId");
	                 
	                 Logger.verifyEquals(return_best.getPlatformCouponInfo().getRuleId()==null?null:bean.getRules().get(0).getRuleId(), return_best.getPlatformCouponInfo().getRuleId(), "验证平台最优RuleId");
	                 
	                 Logger.verifyEquals(bean.getRules().get(0).getMode(), return_best.getPlatformCouponInfo().getMode(), "验证平台最优Mode");
	                 
	                 Logger.verifyEquals(coupons.size()==0?true:false, return_best.getPlatformCouponInfo().getNeedReceive(), "验证平台最优NeedReceive");
	        	 }
	        	 else if(couponbatch.getCreaterType()==2)//买手券
	        	 {
	        		Logger.comment("###########  验证bestCouponList sellerCouponInfo ####################");
	         	    Logger.verifyEquals(sellerCreateBatchCall2.getBatchCode(), return_best.getSellerCouponInfo().getBatchCode(), "验证买手最优batchCode");
	                Logger.verifyEquals(sellerCreateBatchBean2.getBatchName(), return_best.getSellerCouponInfo().getCouponName(), "验证买手最优CouponName");
	                //coupon 没有这个批次就需要重领
	                Logger.verifyEquals(coupons.size()==0?true:false, return_best.getSellerCouponInfo().getNeedReceive(), "验证买手最优NeedReceive");
	                Logger.verifyEquals(couponbatch.getMinOrderValue().stripTrailingZeros().toPlainString(), return_best.getSellerCouponInfo().getMeetAmount().stripTrailingZeros().toPlainString(), "验证买手最优MeetAmount");
	                Logger.verifyEquals(couponbatch.getCouponValue().stripTrailingZeros().stripTrailingZeros().toPlainString(), return_best.getSellerCouponInfo().getDeductionAmount().stripTrailingZeros().toPlainString(), "验证买手最优DeductionAmount");
	        	 }
	         }
	         Logger.comment("###########  验证availableCouponList ####################");
	         //availableCouponList  第一个显示平台，第二个显示买手，若平台没有，则只显示买手；若买手没有，则只显示平台
	         boolean isPlatform=false;
	    	 int i=0;
	         List<couponbatch> batchList=new ArrayList<couponbatch>();
	         for(int k=1;k<=2;k++)
	         {
	        	 Map map = new HashMap();
	    	     map.put("productPrice",bean.getActivityPriceList().get(0).getPrice());
	    	     map.put("userId", bean.getBuyerId());
	    	     map.put("createrType", k);//1平台 2买手
	    	     map.put("batchCode", this.batchCode_two_4000000_3900000); 

	             batchList=couponbatchWapper.getAvailableCouponList(map);
	             if(k==1){ //平台  (是否界面显示)IsShowInPage=1可领取 0不可领取
	              if(batchList.size()>0 )
	            	{
	            		 Logger.comment("##### BatchCode: #####"+couponbatch.getBatchCode());
	            	     Logger.comment(" ##### 可领可用平台券 #######");
		            	 isPlatform=true; 
		            	 Logger.verifyEquals(batchList.get(0).getMinOrderValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getMeetAmount().stripTrailingZeros().toPlainString(), "验证平台可领取可使用列表中的MeetAmount");
		                 Logger.verifyEquals(batchList.get(0).getCouponValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getDeductionAmount().stripTrailingZeros().toPlainString(), "验证平台可领取可使用列表中的DeductionAmount");
		                 Logger.verifyEquals(batchList.get(0).getCreaterType(), return_availableList.get(i).getCreateType(), "验证平台可领取可使用列表中的CreateType=1");
		                 i++;
	            	}
	             }
	             if(k==2){ //买手
	            	map.put("operatorId", bean.getSellerId());//1平台 2买手
	            	map.put("isShowInPage", 1);
	            	map.put("batchCode",sellerCreateBatchCall2.getBatchCode() ); 
	                batchList=couponbatchWapper.getAvailableCouponList(map);
	               if(batchList.size()>0) 
	            	{
	            		Logger.comment("##### BatchCode: #####"+batchList.get(0).getBatchCode());
	            	    Logger.comment(" ##### 可领可用买手券 #######");
	            		//如果没有可领可用的平台券，仅显示买手券
	            		if(isPlatform==true) i=1;
	            		else i=0;
	            		Logger.verifyEquals(batchList.get(0).getMinOrderValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getMeetAmount().stripTrailingZeros().toPlainString(), "验证买手可领取可使用列表中的MeetAmount");
		                Logger.verifyEquals(batchList.get(0).getCouponValue().stripTrailingZeros().toPlainString(), return_availableList.get(i).getDeductionAmount().stripTrailingZeros().toPlainString(), "验证买手可领取可使用列表中的DeductionAmount");
		                Logger.verifyEquals(batchList.get(0).getCreaterType(), return_availableList.get(i).getCreateType(), "验证买手可领取可使用列表中的CreateType=2");
	            	} 
	             }
	         }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_061() {
		Logger.start(true,"商详最优的买手券和平台券-验证优惠券符合满减条件，但已使用-最优和可领列表都不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
			//查询
			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode).get(0);
			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
			//使用优惠券
			this.couponMService.UseCoupon(bean.getBuyerId(), coupon.getCouponCode());
			Thread.sleep(5000);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(3000000));
			
			call.setData(bean);
			call.callService();	
			
			this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_062() {
		Logger.start(true,"商详最优的买手券和平台券-验证未领取的优惠券符合满减条件,但当前批次已作废-最优和可领列表都不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			//this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
			//删除批次
			couponMService.InvalidPlatformBatch(this.batchCode, "autoTest", "自动化测试_"+TestDataManager.getRandomIntNum(5));
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(30000000));
			
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();
			
			couponbatchWapper.setNoInvalid(this.batchCode);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_063() {
		Logger.start(true,"商详最优的买手券和平台券-验证领取的优惠券符合满减条件,但当前批次已作废-最优显示,可领列表都不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,"");
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(30000000));
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
			//删除批次
			couponMService.InvalidPlatformBatch(this.batchCode, "autoTest", "自动化测试_"+TestDataManager.getRandomIntNum(5));

			call.setData(bean);
			call.callService();		
			
			this.check_verify(null, null, this.batchCode);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_064() {
		Logger.start(true,"商详最优的买手券和平台券-验证领取的优惠券符合满减条件,但优惠券已过期-最优和可领列表都不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
			//查询
			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode).get(0);
			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
			//设置过期
			couponWapper.setValidStartByCouponCode( coupon.getCouponCode(),Date.from((LocalDateTime.now().plusDays(-2).atZone(ZoneId.systemDefault()).toInstant())));
			couponWapper.setValidEndByCouponCode( coupon.getCouponCode(),Date.from((LocalDateTime.now().plusDays(-1).atZone(ZoneId.systemDefault()).toInstant())));
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(30000000));
			
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_065() {
		Logger.start(true,"商详最优的买手券和平台券-验证领取的优惠券符合满减条件,优惠券批次当前已领取,但使用优惠券时间开始时间大于当前时间-最优和可领列表都不显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
			//查询
			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode).get(0);
			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_All);
			//设置
			couponWapper.setValidStartByCouponCode( coupon.getCouponCode(),Date.from((LocalDateTime.now().plusDays(1).atZone(ZoneId.systemDefault()).toInstant())));
			couponWapper.setValidEndByCouponCode( coupon.getCouponCode(),Date.from((LocalDateTime.now().plusDays(2).atZone(ZoneId.systemDefault()).toInstant())));

			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(30000000));
			
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_066() {
		Logger.start(true,"商详最优的买手券和平台券-验证领取的优惠券符合满减条件,优惠券当前已领取,但使用结束时间大于当前时间-最优和可领列表都显示");
		try {
			
			bean=initGetProductBestCoupon(this.operatorId,"");
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(),this.ruleId_All);
			//查询
			Map map=couponWapper.selectCouponInfoByBatchCode(this.batchCode).get(0);
			coupon coupon=couponWapper.selectByBatchIdAndUserId(Integer.parseInt(map.get("BatchId").toString()),bean.getBuyerId()).get(0);
			//领取
			this.receiveCouponInfoByRule(bean.getBuyerId(), this.ruleId_All);
			//设置
			couponWapper.setValidStartByCouponCode( coupon.getCouponCode(),Date.from((LocalDateTime.now().plusDays(-1).atZone(ZoneId.systemDefault()).toInstant())));
			couponWapper.setValidEndByCouponCode( coupon.getCouponCode(),Date.from((LocalDateTime.now().plusDays(2).atZone(ZoneId.systemDefault()).toInstant())));

			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(30000000));
			
			call.setData(bean);
			call.callService();		
			
			this.check_verify(null, null, this.batchCode);		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_067() {
		Logger.start(true,"商详最优的买手券和平台券-验证用户在首页没有可领取券的条件-最优不显示、可领列表不显示");
		try {
			bean=initGetProductBestCoupon(this.operatorId,this.ruleId_All);

			//设置 使用时间开始时间小于当前时间
			couponbatchWapper.setAcquireStartTime(this.batchCode, Date.from((LocalDateTime.now().plusDays(1).atZone(ZoneId.systemDefault()).toInstant())));
			couponbatchWapper.setAcquireEndTime(this.batchCode, Date.from((LocalDateTime.now().plusDays(2).atZone(ZoneId.systemDefault()).toInstant())));

			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(30000000));
			
			call.setData(bean);
			call.callService();		
			
			this.check_Empty();	
			
			//设置 使用时间开始时间小于当前时间
			couponbatchWapper.setAcquireStartTime(this.batchCode, Date.from((LocalDateTime.now().plusDays(-2).atZone(ZoneId.systemDefault()).toInstant())));
			couponbatchWapper.setAcquireEndTime(this.batchCode, Date.from((LocalDateTime.now().plusDays(40).atZone(ZoneId.systemDefault()).toInstant())));
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_068() {
		Logger.start(true,"商详最优的买手券和平台券-验证买手优惠券 IsShowInPage=true,不可领取-最优和可领列表都不显示");
		try {
			Integer userId=TestDataManager.getRandomIntNum(10);
			Integer sellerId=TestDataManager.getRandomIntNum(10);
		
			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(580000));
			sellerCreateBatchBean1.setIsShowOnPage(true);
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
		
			bean=initGetProductBestCoupon(sellerId,"");
			bean.setBuyerId(userId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			
			call.setData(bean);
			call.callService();			
			
			check_verify(Arrays.asList(sellerCreateBatchBean1),Arrays.asList(sellerCreateBatchCall1));	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductBestCoupon_069() {
		Logger.start(true,"商详最优的买手券和平台券-验证IsShowInPage=false,可领取-最优和可领列表都不显示");
		try {
			Integer userId=TestDataManager.getRandomIntNum(10);
			Integer sellerId=TestDataManager.getRandomIntNum(10);
		
			SellerCreateBatchBean sellerCreateBatchBean1=couponMService.setDefaultSellerCreateBatchBean();
			sellerCreateBatchBean1.setSellerId(sellerId);
			sellerCreateBatchBean1.setOrderMinAmount(new BigDecimal(600000));
			sellerCreateBatchBean1.setCouponAmount(new BigDecimal(580000));
			sellerCreateBatchBean1.setIsShowOnPage(false);
			SellerCreateBatchCall sellerCreateBatchCall1=couponMService.SellerCreateBatch(sellerCreateBatchBean1);
		
			bean=initGetProductBestCoupon(sellerId,"");
			bean.setBuyerId(userId);
			
			bean.getActivityPriceList().get(0).setPrice(new BigDecimal(7000000));
			
			call.setData(bean);
			call.callService();			
			
			this.check_Empty();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
}